package org.jeecg.modules.rooms.controller;


import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.jeecg.common.Enum.ResultCode;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.modules.rooms.entity.CesRoomLayout;
import org.jeecg.modules.rooms.entity.CesRoomLayoutMemberPrice;
import org.jeecg.modules.rooms.service.CesRoomLayoutMemberPriceServiceImpl;
import org.jeecg.modules.rooms.service.CesRoomLayoutServiceImpl;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 房型会员价格 记录表 前端控制器
 * </p>
 *
 * @author fendo
 * @since 2023-03-06
 */
@RestController
@RequestMapping("/rooms/cesRoomLayoutMemberPrice")
@Api(tags="ces_room_layout_member_price")
@Slf4j
public class CesRoomLayoutMemberPriceController extends JeecgController<CesRoomLayoutMemberPrice, CesRoomLayoutMemberPriceServiceImpl> {
        @Resource
        private  CesRoomLayoutMemberPriceServiceImpl memberPriceService;

        @AutoLog(value = "获取会员等级价格")
        @ApiOperation(value="获取会员等级价格", notes="获取会员等级价格")
        @GetMapping(value = "/getListByParentId")
        public Result getListByParentId(String parentId){
            if(StringUtils.isBlank(parentId)){
                return Result.error(ResultCode.PARAM_MISS);
            }
            try{
                List<CesRoomLayoutMemberPrice>  memberPriceList = memberPriceService.getListByParentId(parentId);
                return  Result.ok(memberPriceList);
            }catch (Exception e){
                return Result.error(e.getMessage());
            }
        }
}

